<template>
	<view class="order">
		<view class="content">
			<view class="list">
				<view class="top clearfix">
					<view class="left fl">
						<image :src="baseUrl + '/wximage/order_dingdan.png'" class="fl"></image>
					</view>
					<view class="wancheng fr">{{info.statustitle}}</view>
				</view>
				<view class="center">
					<view class="li clearfix">
						<view class="name fl">订单编号：</view>
						<view class="desc fr">{{info.out_order_no}}</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">充电时间：</view>
						<view class="desc fr">{{info.sdate}}</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">归还时间：</view>
						<view class="desc fr">{{info.edate}}</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">累计时间：</view>
						<view class="desc fr">{{info.sjshichang}}</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">设备编号：</view>
						<view class="desc fr">{{info.charge_number}}</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">宝编号：</view>
						<view class="desc fr">{{info.charge_bao_sn}}</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">端口号：</view>
						<view class="desc fr">{{info.duankou}}</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">宝类型：</view>
						<view class="desc fr" v-if="info.bao_leixing == 1">普通宝</view>
						<view class="desc fr" v-else>快充宝</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">租借地点：</view>
						<view class="desc fr">{{info.wdtitle}}</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">归还地点：</view>
						<view class="desc fr">{{info.ghwdtitle}}</view>
					</view>
					<view class="li clearfix">
						<view class="name fl">支付方式：</view>
						<view class="desc fr">{{info.pay_type}}</view>
					</view>
					<view class="li clearfix" v-if="info.attr == 2">
						<view class="name fl">会员：</view>
						<view class="desc fr" v-if="info.huiyuan_jmleixing == 1">
							减免{{info.huiyuan_jmshichang}}小时
						</view>
						<view class="desc fr" v-if="info.huiyuan_jmleixing == 2">
							减免{{info.huiyuan_jmjie}}元
						</view>
					</view>
					<view class="li clearfix" v-if="info.coupons_id">
						<view class="name fl">优惠券：</view>
						<view class="desc fr" v-if="info.youhui_jmleixing == 1">
							减免{{info.youhui_minus}}元
						</view>
						<view class="desc fr" v-if="info.youhui_jmleixing == 2">
							减免{{info.youhui_minus}}小时
						</view>
					</view>
				</view>
				<view class="bottom clearfix">
					<view class="price fr">已支付：{{info.money}}元</view>
				</view>
			</view>
		</view>
		<view class="footer">
			<view class="hengxian"></view>
			<view class="footnav clearfix">
				<view class="li fl" @click="call">
					<image :src="baseUrl + '/wximage/order_kefu.png'"></image>
					<view class="title">在线客服</view>
				</view>
				<view class="li fl" @click="topage('/pages/user/question')">
					<image :src="baseUrl + '/wximage/order_fankui.png'"></image>
					<view class="title">遇到问题</view>
				</view>
				<view class="li fl" @click="topage('/pages/index/nearstore')">
					<image :src="baseUrl + '/wximage/order_fujin.png'"></image>
					<view class="title">附近门店</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				baseUrl: getApp().globalData.baseUrl,
				x_tell: '',
				id: '',
				info: {
					status: '',
					statustitle: '',
					money: '',
					out_order_no: '',
					sdate: '',
					wdtitle: '',
					dizhi: '',
					ghdizhi: '',
					ghwdtitle: '',
					charge_number: '',
					duankou: '',
					charge_bao_sn: '',
					bao_leixing: '',
					sjshichang: '',
					pay_type: '',
					edate: '',
					attr: '',
					huiyuan_jmleixing: '',
					huiyuan_jmshichang: '',
					huiyuan_jmjie: '',
					coupons_id: '',
					youhui_jmleixing: '',
					youhui_minus: '',
				}
			}
		},
		onLoad(options) {
			//获取基本配置信息
			this.request({
				url: '/xcx/webconfig',
				data: {}
			}).then(res => {
				if (res.data.code == 200) {
					this.x_tell = res.data.data.x_tell;
				} else {
					uni.showToast({
						title: '请求失败，请稍后再试',
						icon: 'none'
					})
				}
			})
			
			this.id = options.id;
			
			this.request({
				url: '/xcx/orderDetail',
				data: {
					id: this.id,
					agent_id: '',
					role_id: '',
				},
				method: "POST"
			}).then(res => {
				if (res.data.code == 200) {
					this.info = res.data.data;
				} else {
					uni.showToast({
						title: '请求失败，请稍后再试',
						icon: 'none'
					})
				}
			})
		},
		methods:{
			call() {
				let tell = this.x_tell;
				uni.makePhoneCall({
					phoneNumber: tell,
					success(res) {
			
					},
					fail(res) {
			
					}
				})
			},
			topage(url){
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: #F8F8F8;
	}
	
	.order{
		width: 100%;
		margin: 0 auto;
		
		.content{
			width: 90%;
			margin: 20rpx auto;
			
			.list{
				width: 100%;
				padding: 20rpx 30rpx;
				box-sizing: border-box;
				background: #ffffff;
				border-radius: 20rpx;
				margin-bottom: 20rpx;
				
				.top{
					line-height: 48rpx;
					border-bottom: 1rpx solid #D8D8D8;
					padding-bottom: 14rpx;
					
					.left{
						
						image{
							width: 48rpx;
							height: 48rpx;
							margin-right: 8rpx;
						}
						
						.title{
							font-size: 24rpx;
							color: #999999;
						}
					}
					
					.wancheng{
						font-size: 28rpx;
						color: #1BE0CD;
						font-weight: 700;
					}
				}
				
				.center{
					margin-top: 20rpx;
					border-bottom: 1rpx solid #D8D8D8;
					
					.li{
						margin-bottom: 20rpx;
						
						.name{
							font-size: 24rpx;
							color: #666666;
							width: 20%;
						}
						
						.desc{
							width: 70%;
							font-size: 24rpx;
							color: #666666;
							text-align: right;
						}
					}
				}
				
				.bottom{
					margin-top: 26rpx;
					height: 38rpx;
					line-height: 38rpx;
					
					.price{
						font-size: 28rpx;
						font-weight: 700;
						color: #ED7E55;
					}
				}
			}
		}
		
		.footer{
			position: fixed;
			width: 100%;
			left: 0;
			bottom: 60rpx;
		}
		
		.hengxian{
			width: 90%;
			margin: 0 auto 40rpx;
			height: 2rpx;
			background: #D8D8D8;
		}
		
		.footnav{
			width: 90%;
			margin: 0 auto;
			
			.li{
				width: 200rpx;
				height: 72rpx;
				line-height: 72rpx;
				background: #F0F1F3;
				border-radius: 12rpx;
				margin-right: 36rpx;
				
				image{
					width: 48rpx;
					height: 48rpx;
					float: left;
					margin-left: 20rpx;
					margin-right: 4rpx;
					margin-top: 12rpx;
				}
				
				.title{
					font-size: 24rpx;
					color: #333333;
					float: left;
				}
			}
			
			.li:last-child{
				margin-right: 0;
			}
		}
	}
</style>